package BaseTest

import scala.collection.mutable

object MapDemo {
  /**
   * 不可变的Map，长度内容都不可变，跟val或var修饰无关系
   */
  def main(args: Array[String]): Unit = {
    val m1 = Map("zhangyi" -> "帅", "kangbiao" -> "丑")
    println(m1)
    println(m1("zhangyi"))
    val v1 = m1.getOrElse("w", -1)
    println(v1)


    val m2 = mutable.Map("zhangyi" -> "帅", "kangbiao" -> "丑")
    m2.put("dada", "111")
    m2 += "ccc" -> "333"
    m2 += (("xx", "456"))
    println(m2)
    m2 -= "xx"
    println(m2)
  }

}
